<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
String path = request.getContextPath();
%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<html:html locale="true">
<head>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<title></title>
<link href="console.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {font-size: 16px}
-->
.even {
	background:	#eee;
}

.odd {

}
</style>
</head>

<body>
<jsp:include page="/title.jsp" flush="true"/>

	<p class="lnkhead2"><bean:message key='menu.engines'/>&gt;<bean:write name="domain"  filter="true"/>&gt;<bean:message key='menu.processDefinitions'/>&gt;<bean:message key='menu.processDefinitionsBuilding'/>&gt;<bean:write name='type'/></p>
	<form name="form" method="post" action="processManagement.do">
	<input type="hidden" name="act"/>
	<input type="hidden" name="replace"/>
	<input type="hidden" name="type" value="<bean:write name='type'/>"/>
	<input type="hidden" name="domain" value="<bean:write name='domain'/>"/>
		<input type="hidden" name="pageup" value="<bean:write name='pageup'/>"/>			
			<input type="hidden" name="begin"  value="0"/>		
			<input type="hidden" name="pagedown" value="<bean:write name='pagedown'/>"/>
	<table width="100%" border="0" cellpadding="1" class="sort-table" id="table-1" cellspacing="0">
	
	<thead>
			
			<tr >
				<td align="center" width="8%">				
&nbsp;					
				</td>
				<td align="center" width="10%">
					
					<bean:message key="heading.id"/>
					
				</td>
				
				<td align="center" width="10%">
					
					<bean:message key="heading.name"/>
					
				</td>
				<td align="center" width="10%">
					
					<bean:message key="heading.type"/>
					
				</td>
				
				<td align="center" width="28%">
					
					<bean:message key="heading.desc"/>
					
				</td>
				
				<td align="center" width="13%">
					
					<bean:message key="heading.createDate"/>
					
				</td>
				
				<td align="center" width="13%">
					
					<bean:message key="heading.updateDate"/>
					
				</td>
			</tr>
	  </thead>
			<tbody>
			<% int i=0; String color;String check="";%>
			
			<logic:iterate id="process" name="processlist">
				<% i++; if(i%2==1) color="odd"; else color="even"; if(i==1) check="checked"; else check="";%>
				
				<tr  class="<%=color%>">
					<td align="left">
					<input type="radio" <%=check%> name="processId"  value="<bean:write name="process" property="processId"/>" />
						<bean:write name="process" property="sortIndex"/>			
					</td>
					<td align="left">
						
						<bean:write name="process" property="processId" filter="true"/>
						<logic:equal value="false" name="process" property="isOk">
						<img src="images/warn.gif" />
						</logic:equal>
					</td>
					
					<td align="left">
						<bean:write name="process" property="name" filter="true"/>
					</td>
					<td align="center">
						
						<bean:write name="process" property="flowTypeName"/>
						
					</td>
					
					<td align="center">
						
						<bean:write name="process" property="desc" filter="true"/>
						
					</td>
					
					<td align="center">
						
						<bean:write format="yyyy-MM-dd HH:mm" name="process" property="createDate"/>
						
					</td>
					
					<td align="center">
						
						<bean:write format="yyyy-MM-dd HH:mm" name="process" property="updateDate"/>
						
					</td>
				</tr>
			
			</logic:iterate>
	  </tbody>
</table>
	<table width="100%">		
			<tr >
				<td align="left">
				<input  type="button" name="newProcess" value="<bean:message key='process.newDef'/>" onclick="javascript:addProcess()">
				<input  type="button" name="edit" value="<bean:message key='process.editDef'/>" onclick="javascript:editProcess()">
				<input  type="button" name="delete" value="<bean:message key='process.delDef'/>" onclick="javascript:deleteProcess()">
				<input  type="button" name="set" value="<bean:message key='process.setReady'/>" onclick="javascript:setReady()">
				<input  type="button" name="uploadProcess" value="<bean:message key='process.upload'/>" onclick="javascript:upload1()">
					<input  type="button" name="downloadProcess" value="<bean:message key='process.download'/>" onclick="javascript:download1()">
				</td>
				<td align="right">
					
					<logic:greaterEqual name="pageup" value="0">
						
						<a  class="lnksub1" href="javascript:pageup()">
							
							<bean:message key="button.pageup"/>
							
						</a>
						
					</logic:greaterEqual>
					
					<logic:notEqual name="pagedown" value="0">
						
						<a  class="lnksub1" href="javascript:pagedown()">
							
							<bean:message key="button.pagedown"/>
							
						</a>
						
					</logic:notEqual>
					</td>
				
			</tr>
			</table>
			
			
			<div id="download_div"  style="visibility:hidden; z-index:2" >
		
		<table width="77%" border="0" cellpadding="0"  cellspacing="0">
		<tr  class="txtnormal2">			

			<td><input type="radio" checked name="downloadtype"  value="process" />
				<bean:message key='process.selected'/>
			</td>
				<td><input type="radio" name="downloadtype"  value="type" />
				<bean:message key='process.typeAll'/>
			</td>
			
			<td><td><input type="radio" name="downloadtype"  value="typetree" />
				<bean:message key='process.typeAndSubType'/>
				</td>
				<td>
			<input  type="button" name="download_button" value="<bean:message key='button.download'/>" onclick="javascript:download()">
			</td>
	</tr>
</table>
	</div>
	</form>
	<div id="upload_div"  style="visibility:hidden; z-index:2" >
		<form name="form1" enctype="multipart/form-data" method="post" action="processManagement.do">
 
		<table width="50%" border="0" cellpadding="0"  cellspacing="0">
		<tr  class="txtnormal2">	
		<td>		
 <input type="file" name="file">
 </td>
			
				<td>
				<input type="hidden" name="act" value="upload"/>
					<input type="hidden" name="type" value="<bean:write name='type'/>"/>
	<input type="hidden" name="domain" value="<bean:write name='domain'/>"/>
			<input  type="button" name="Submit" value="<bean:message key='button.upload'/>" onclick="javascript:upload()">
			</td>
	</tr>
</table>
</form>
	</div>
			<script type="text/javascript">
var st = new SortableTable(document.getElementById("table-1"),
	["None","String", "String","String",  "None", "String","String"]);
	</script>
	<script type="text/javascript">
	function pagedown()
	{
	var frm = document.forms["form"];
	frm.elements["begin"].value=frm.elements["pagedown"].value;
	frm.elements["act"].value="listProcessInDev";
	frm.submit();
	}
	function pageup()
	{
	var frm = document.forms["form"];
	frm.elements["begin"].value=frm.elements["pageup"].value;
	frm.elements["act"].value="listProcessInDev";
	frm.submit();	
	}
	function addProcess(){
	var frm = document.forms["form"];
	frm.elements["act"].value="newProcess";
	frm.target="_blank";
	frm.submit();
	};
	function editProcess(){
	var frm = document.forms["form"];
	frm.elements["act"].value="editProcess";
	frm.target="_blank";
	frm.submit();
	};
	
	function deleteProcess(){
	var frm = document.forms["form"];
	var processId=(selectedRadiobox(frm,"processId"));
	if( !confirm("<bean:message key='process.confirmDelete'/>("+processId+") ?")) return;
	frm.elements["act"].value="deleteDev";
	frm.target="_self";
	frm.submit();
	};
	
	function setReady(){
	var frm = document.forms["form"];
	var processId=(selectedRadiobox(frm,"processId"));
	if( confirm('<bean:message key="process.setProcessReadyMessage"/>')) {
	frm.elements["replace"].value="true";
	}else{
	frm.elements["replace"].value="false";
	}
	frm.elements["act"].value="setReady";
	frm.target="_self";
	frm.submit();
	};
	</script>
	<script type="text/javascript">
	function download(){
	var frm = document.forms["form"];
	frm.elements["act"].value="download";
	frm.target="_self";
	frm.submit();
	}
	function download1(){
	 shift_visibility(download_div); 
	 }
	 
	 function upload(){
	var frm = document.forms["form1"];
	if(frm.elements["file"].value==""){
	alert("<bean:message key='button.mustSelectFile'/>");
	return;
	}
	frm.target="_self";
	frm.submit();
	}
	function upload1(){
	 shift_visibility(upload_div);
	 
	 }
	 function shift_visibility(image1){
 if(image1.style.visibility == "visible")
  image1.style.visibility = "hidden";
  else  image1.style.visibility = "visible";
};
</script>
<%@ include file="/table_bottom.jsp" %>
<logic:notEmpty name="returnMsg">
	<script>
	alert('<bean:write name="returnMsg"/>');
	</script>
	</logic:notEmpty>
</body>
</html:html>



